const canvas = document.querySelector('.myCanvas')
const width = (canvas.width = window.innerWidth)
const height = (canvas.height = window.innerHeight)

const ctx = canvas.getContext("2d")

ctx.fillStyle = 'rgb(0,0,0)'
ctx.fillRect(0,0,width,height)

const image = new Image();
image.src = "./白后.png"
// image.addEventListener('load',()=>ctx.drawImage(image,20,20))
image.addEventListener('load',()=>ctx.drawImage(image, 0, 0, 580, 580, 100, 100, 290, 290))
//前四个属性表示从图片的哪个位置开始截取多大的图片
//后四个属性表示在画板上的哪个点放置缩放到多大图片

